<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/static/css/bootstrap4.0.min.css" >
    <script src="/static/js/jquery.slim.min.js" ></script>
    <script src="/static/js/popper.min.js" ></script>
    <script src="/static/js/bootstrap4.0.min.js"></script>
    <script type="text/javascript" src="/static/js/wangEditor.min.js"></script>

    <!--wangEditor高度设置-->
    <style>
        .w-e-text-container {
            height: 66% !important;
        }
    </style>
    <script type="text/javascript">
        $("container").ready(
            function() {
                var E = window.wangEditor
                var editor = new E('#div1')
                var $text1 = $('#content')
                editor.customConfig.onchange = function (html) {
                    // 监控变化，同步更新到 textarea
                    $text1.val(html)
                }
                editor.create()
                // 初始化 textarea 的值
                $text1.val(editor.txt.html())
            }
        )
    </script>
</head>
<body>
    <div style="position: relative;top: 10%">
        <c:if test="${!empty succ}">
            <div class="alert alert-success" role="alert">
                    ${succ}
            </div>
        </c:if>
        <c:if test="${!empty error}">
            <div class="alert alert-danger" role="alert">
                ${error}
            </div>
        </c:if>
    </div>
    <div class="container">
        <form action="/jsp/admin/article/add/do" method="post">
            <div class="form-group">
                <label for="title">文章标题</label>
                <input type="text" class="form-control" id="title" name="title" placeholder="文章标题">
            </div>
            <div class="form-group">
                <label for="keywords">关键字</label>
                <input type="text" class="form-control" id="keywords" name="keywords" placeholder="关键字">
            </div>
            <div class="form-group">
                <label for="desci">简介</label>
                <textarea class="form-control" id="desci" rows="3" name="desci" placeholder="简介"></textarea>
            </div>
            <div class="form-group">
                <label for="div1">内容</label>
                <div id="div1" ></div>
                <textarea id="content" name="content" style="display: none"></textarea>
            </div>
            <div align="center">
                <input type="submit" value="发表" style="margin-bottom:100px;width:66px;background-color: #AB82FF"/>
            </div>
        </form>
    </div>
</body>
</html>